fix: use environment variables to check for terminal #2330
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #2278 finds CLibrary.isatty gives an error when any
maestro
command is run unless both the --no-color and --no-ansi flags are given. This fix switches to environment variables because on CachyOS Linux and Fedora Linux users consistently got those errors.Proposed changes
I switched from using the CLibrary.isatty to using environment variables to check if the call is from a terminal.
Based on the issue, it seems this may be a Linux specific problem. If the team would rather solve this another way, I am happy to help if you would like to direct me how you want it solved. Otherwise, if the team would prefer to go another direction without my help, that is also understandable.
Testing
I ran the
./maestro-cli/build/install/maestro/bin/maestro
command with no flags and got expected output.I also got the demo_app in the
e2e/
directory installed on an Android Emulator and ran the tests provided. The output is below.Ran the
./maestro-cli/build/install/maestro/bin/maestro --device emulator-5554 test e2e/workspaces/demo_app
command.Output from tests
Issues fixed
Possible fix for Issue #2278
Feedback welcome
I am new to Maestro, so I would appreciate any feedback on how I solved the issue, if I should delete the comments in the code, and anything else that would help the team or project better.